//
//  ViewController.m
//  06-qq的导航栏
//
//  Created by 王道林 on 16/7/21.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.094 green:0.659 blue:0.953 alpha:1.000];
    UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:@[@"消息", @"电话"]];
    // 属性改变segment的字体
    
    [segment setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:22]} forState:UIControlStateNormal];
    
    segment.frame = CGRectMake(0, 0, 150, 30);
    
    // bar上的所有东西颜色
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationItem.titleView = segment;
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"iconfont-QQ.png"] style:UIBarButtonItemStylePlain target:self action:@selector(personZiliao)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
    
    // 自定义的item
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
    imageView.image = [UIImage imageNamed:@"1.jpg"];
    imageView.layer.masksToBounds = YES;
    imageView.layer.cornerRadius = 22;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:imageView];
    
}

- (void)personZiliao
{
    NSLog(@"个人资料");
}

- (void)add
{
    NSLog(@"添加");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
